package com.bh.statistics.service.impl;

import com.bh.common.utils.SecurityUtils;
import com.bh.statistics.mapper.JcStatisticsMapper;
import com.bh.statistics.service.IJcStatisticsService;
import com.bh.system.domain.SysNotice;
import com.bh.system.mapper.SysNoticeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @Description
 * @Author slx
 * @Date 2024/3/18
 */
@Service
public class JcStatisticsServiceImpl implements IJcStatisticsService {

    @Autowired
    private JcStatisticsMapper statisticsMapper;
    @Autowired
    private SysNoticeMapper noticeMapper;

    @Override
    public Integer selectJcOrderCount() {
        return statisticsMapper.selectJcOrderCount(SecurityUtils.getOrgId());
    }

    @Override
    public Integer selectJcShipmentCount() {
        return statisticsMapper.selectJcShipmentCount(SecurityUtils.getOrgId());
    }

    @Override
    public Integer selectOrgCount() {
        return statisticsMapper.selectOrgCount();
    }

    @Override
    public Integer selectJcAmount() {
        return statisticsMapper.selectJcAmount(SecurityUtils.getOrgId());
    }

    @Override
    public Integer selectJcCustomerCount() {
        return statisticsMapper.selectJcCustomerCount(SecurityUtils.getOrgId());
    }

    @Override
    public Map<String, Integer> selectJcWeekOrderCount() {
        return statisticsMapper.selectJcWeekOrderCount(SecurityUtils.getOrgId());
    }

    @Override
    public Map<String, Integer> selectJcWeekShipmentCount() {
        return statisticsMapper.selectJcWeekShipmentCount(SecurityUtils.getOrgId());
    }

    @Override
    public Map<String, Integer> selectTopFiveCustomerOrderCount() {
        return statisticsMapper.selectTopFiveCustomerOrderCount(SecurityUtils.getOrgId());
    }

    @Override
    public Map<String, Integer> selectOrderCalendar() {
        // 查找当月的每日订单数量
        return statisticsMapper.selectOrderCalendar(SecurityUtils.getOrgId());
    }

    @Override
    public List<SysNotice> selectNotice() {
        return noticeMapper.selectNoticeList(new SysNotice());
    }
}
